﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QListWidgetItem>
#include <QString>
#include <lyrics.h>


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    //自定义槽函数
    void onStateChanged(QMediaPlayer::State state);

    void onPlaylistChanged(int position);

    void onDurationChanged(qint64 duration);
    void onPositionChanged(qint64 position);


    void on_btnAdd_clicked();

    void on_btnRemove_clicked();

    void on_btnClear_clicked();


    void on_listWidget_doubleClicked(const QModelIndex &index);

    void on_sliderVolumn_valueChanged(int value);

    void on_sliderPosition_valueChanged(int value);



    void on_btnPlay_clicked();

    void on_btnPause_clicked();

    void on_btnStop_clicked();

    void on_btnPrevious_clicked();

    void on_btnNext_clicked();

    void on_btnSound_clicked();
    void on_btnPlayModel_clicked();

public:
    void PlaybackModel(QMediaPlaylist::PlaybackMode model);//播放模式改变
    void setui();
    void setPlayTime();

private:
    QMediaPlayer *player; //播放器
    QMediaPlaylist *playList; //播放列表

    QString durationTime;//总长度
    QString  positionTime;//当前播放到位置

    //歌词相关
    QString playPath;
    Lyrics lyrics;
    int playRow;
    int playTime;
    int lyricsID=0;
private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
